package com.vkdasari.youtube.ui;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.ImageIcon;
import javax.swing.JFrame;

public class MainFrame extends JFrame{
	
	static private MainFrame instance=null;
	
	static public synchronized MainFrame getInstance(){
		if(instance == null){
			instance = new MainFrame();
		}
		return instance;
	}

	/* (non-Javadoc)
	 * @see javax.swing.JFrame#frameInit()
	 */
	@Override
	protected void frameInit() {
		super.frameInit();
		setTitle("Zebra YouTube Client");
		setDefaultCloseOperation(EXIT_ON_CLOSE);
		setIconImage(new ImageIcon(getClass().getClassLoader().getResource("icon/Zebra.png")).getImage());

		// Size it
		Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
		Dimension preferredDimension = new Dimension((int)screenDimension.getWidth() - 60, (int)screenDimension.getHeight() - 60);
		setPreferredSize(preferredDimension);
		
		
		// Create Main Panel
		
		MainPanel mainPanel = MainPanel.getInstance();
		
		final Container contentPane =  getContentPane();
		contentPane.add(mainPanel, BorderLayout.CENTER);
		
		
		
	}
	
	
	
}
